{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import time\n",
    "import xgboost as xgb\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.model_selection  import GridSearchCV \n",
    "from xgboost.sklearn import XGBClassifier\n",
    "from sklearn import  metrics    #scklearn functions\n",
    "import matplotlib.pylab as plt\n",
    "%matplotlib inline\n",
    "# from matplotlib.pylab import rcParams\n",
    "# rcParams['figure.figsize'] = 12, 4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>uid</th>\n",
       "      <th>spu_id</th>\n",
       "      <th>type</th>\n",
       "      <th>date</th>\n",
       "      <th>uiclick_3</th>\n",
       "      <th>uibuy_3</th>\n",
       "      <th>ui_ratio_3</th>\n",
       "      <th>uiclick_8</th>\n",
       "      <th>uibuy_8</th>\n",
       "      <th>ui_ratio_8</th>\n",
       "      <th>...</th>\n",
       "      <th>ub_ratio_8</th>\n",
       "      <th>ubbuy_21</th>\n",
       "      <th>ubclick_21</th>\n",
       "      <th>ub_ratio_21</th>\n",
       "      <th>ubbuy_34</th>\n",
       "      <th>ubclick_34</th>\n",
       "      <th>ub_ratio_34</th>\n",
       "      <th>ubbuy_89</th>\n",
       "      <th>ubclick_89</th>\n",
       "      <th>ub_ratio_89</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>228326</td>\n",
       "      <td>1080895</td>\n",
       "      <td>0</td>\n",
       "      <td>03-22</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>253864</td>\n",
       "      <td>2038905</td>\n",
       "      <td>0</td>\n",
       "      <td>03-23</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>154840</td>\n",
       "      <td>1330378</td>\n",
       "      <td>0</td>\n",
       "      <td>03-20</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>454004</td>\n",
       "      <td>311406</td>\n",
       "      <td>0</td>\n",
       "      <td>03-24</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>102550</td>\n",
       "      <td>1415108</td>\n",
       "      <td>0</td>\n",
       "      <td>03-22</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 79 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      uid   spu_id  type   date  uiclick_3  uibuy_3  ui_ratio_3  uiclick_8  \\\n",
       "0  228326  1080895     0  03-22       -1.0     -1.0        -1.0       -1.0   \n",
       "1  253864  2038905     0  03-23       -1.0     -1.0        -1.0       -1.0   \n",
       "2  154840  1330378     0  03-20       -1.0     -1.0        -1.0       -1.0   \n",
       "3  454004   311406     0  03-24       -1.0     -1.0        -1.0       -1.0   \n",
       "4  102550  1415108     0  03-22       -1.0     -1.0        -1.0       -1.0   \n",
       "\n",
       "   uibuy_8  ui_ratio_8     ...       ub_ratio_8  ubbuy_21  ubclick_21  \\\n",
       "0     -1.0        -1.0     ...             -1.0      -1.0        -1.0   \n",
       "1     -1.0        -1.0     ...             -1.0      -1.0        -1.0   \n",
       "2     -1.0        -1.0     ...             -1.0      -1.0        -1.0   \n",
       "3     -1.0        -1.0     ...             -1.0      -1.0        -1.0   \n",
       "4     -1.0        -1.0     ...             -1.0      -1.0        -1.0   \n",
       "\n",
       "   ub_ratio_21  ubbuy_34  ubclick_34  ub_ratio_34  ubbuy_89  ubclick_89  \\\n",
       "0         -1.0      -1.0        -1.0         -1.0      -1.0        -1.0   \n",
       "1         -1.0      -1.0        -1.0         -1.0      -1.0        -1.0   \n",
       "2         -1.0      -1.0        -1.0         -1.0      -1.0        -1.0   \n",
       "3         -1.0      -1.0        -1.0         -1.0      -1.0        -1.0   \n",
       "4         -1.0      -1.0        -1.0         -1.0       0.0         9.0   \n",
       "\n",
       "   ub_ratio_89  \n",
       "0         -1.0  \n",
       "1         -1.0  \n",
       "2         -1.0  \n",
       "3         -1.0  \n",
       "4          0.0  \n",
       "\n",
       "[5 rows x 79 columns]"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train = pd.read_csv('cache/off_train_feat3.csv')\n",
    "train = train.fillna(-1)\n",
    "train.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>uid</th>\n",
       "      <th>spu_id</th>\n",
       "      <th>type</th>\n",
       "      <th>date</th>\n",
       "      <th>uiclick_3</th>\n",
       "      <th>uibuy_3</th>\n",
       "      <th>ui_ratio_3</th>\n",
       "      <th>uiclick_8</th>\n",
       "      <th>uibuy_8</th>\n",
       "      <th>ui_ratio_8</th>\n",
       "      <th>...</th>\n",
       "      <th>ub_ratio_8</th>\n",
       "      <th>ubbuy_21</th>\n",
       "      <th>ubclick_21</th>\n",
       "      <th>ub_ratio_21</th>\n",
       "      <th>ubbuy_34</th>\n",
       "      <th>ubclick_34</th>\n",
       "      <th>ub_ratio_34</th>\n",
       "      <th>ubbuy_89</th>\n",
       "      <th>ubclick_89</th>\n",
       "      <th>ub_ratio_89</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>522945</td>\n",
       "      <td>338312</td>\n",
       "      <td>0</td>\n",
       "      <td>03-28</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>334640</td>\n",
       "      <td>1130939</td>\n",
       "      <td>0</td>\n",
       "      <td>03-27</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>420321</td>\n",
       "      <td>1603326</td>\n",
       "      <td>0</td>\n",
       "      <td>03-27</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>44.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>44.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>141.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>41979</td>\n",
       "      <td>713518</td>\n",
       "      <td>0</td>\n",
       "      <td>03-29</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>69.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>534150</td>\n",
       "      <td>1009663</td>\n",
       "      <td>0</td>\n",
       "      <td>03-28</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 79 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      uid   spu_id  type   date  uiclick_3  uibuy_3  ui_ratio_3  uiclick_8  \\\n",
       "0  522945   338312     0  03-28       -1.0     -1.0        -1.0       -1.0   \n",
       "1  334640  1130939     0  03-27       -1.0     -1.0        -1.0       -1.0   \n",
       "2  420321  1603326     0  03-27       -1.0     -1.0        -1.0       -1.0   \n",
       "3   41979   713518     0  03-29       -1.0     -1.0        -1.0       -1.0   \n",
       "4  534150  1009663     0  03-28       -1.0     -1.0        -1.0       -1.0   \n",
       "\n",
       "   uibuy_8  ui_ratio_8     ...       ub_ratio_8  ubbuy_21  ubclick_21  \\\n",
       "0     -1.0        -1.0     ...             -1.0      -1.0        -1.0   \n",
       "1     -1.0        -1.0     ...             -1.0       0.0         5.0   \n",
       "2     -1.0        -1.0     ...              0.0       0.0        44.0   \n",
       "3     -1.0        -1.0     ...              0.0       0.0        52.0   \n",
       "4     -1.0        -1.0     ...             -1.0      -1.0        -1.0   \n",
       "\n",
       "   ub_ratio_21  ubbuy_34  ubclick_34  ub_ratio_34  ubbuy_89  ubclick_89  \\\n",
       "0         -1.0      -1.0        -1.0         -1.0      -1.0        -1.0   \n",
       "1          0.0       0.0         5.0          0.0       0.0         5.0   \n",
       "2          0.0       0.0        44.0          0.0       0.0       141.0   \n",
       "3          0.0       0.0        52.0          0.0       0.0        69.0   \n",
       "4         -1.0      -1.0        -1.0         -1.0      -1.0        -1.0   \n",
       "\n",
       "   ub_ratio_89  \n",
       "0         -1.0  \n",
       "1          0.0  \n",
       "2          0.0  \n",
       "3          0.0  \n",
       "4         -1.0  \n",
       "\n",
       "[5 rows x 79 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test = pd.read_csv('cache/online_train_feat3.csv')\n",
    "test = test.fillna(-1)\n",
    "test.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>uid</th>\n",
       "      <th>spu_id</th>\n",
       "      <th>type</th>\n",
       "      <th>buy</th>\n",
       "      <th>click</th>\n",
       "      <th>u_ratio</th>\n",
       "      <th>buy_2</th>\n",
       "      <th>click_2</th>\n",
       "      <th>u_ratio_2</th>\n",
       "      <th>buy_3</th>\n",
       "      <th>...</th>\n",
       "      <th>u_ratio_21</th>\n",
       "      <th>buy_34</th>\n",
       "      <th>click_34</th>\n",
       "      <th>u_ratio_34</th>\n",
       "      <th>buy_55</th>\n",
       "      <th>click_55</th>\n",
       "      <th>u_ratio_55</th>\n",
       "      <th>buy_89</th>\n",
       "      <th>click_89</th>\n",
       "      <th>u_ratio_89</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>5.083683e+06</td>\n",
       "      <td>5.083683e+06</td>\n",
       "      <td>5.083683e+06</td>\n",
       "      <td>5.083683e+06</td>\n",
       "      <td>5.083683e+06</td>\n",
       "      <td>5.083683e+06</td>\n",
       "      <td>5.083683e+06</td>\n",
       "      <td>5.083683e+06</td>\n",
       "      <td>5.083683e+06</td>\n",
       "      <td>5.083683e+06</td>\n",
       "      <td>...</td>\n",
       "      <td>5.083683e+06</td>\n",
       "      <td>5.083683e+06</td>\n",
       "      <td>5.083683e+06</td>\n",
       "      <td>5.083683e+06</td>\n",
       "      <td>5.083683e+06</td>\n",
       "      <td>5.083683e+06</td>\n",
       "      <td>5.083683e+06</td>\n",
       "      <td>5.083683e+06</td>\n",
       "      <td>5.083683e+06</td>\n",
       "      <td>5.083683e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>3.242576e+05</td>\n",
       "      <td>1.057647e+06</td>\n",
       "      <td>1.103865e-02</td>\n",
       "      <td>-3.064489e-01</td>\n",
       "      <td>1.408126e+01</td>\n",
       "      <td>-4.078690e-01</td>\n",
       "      <td>-8.543884e-02</td>\n",
       "      <td>2.788951e+01</td>\n",
       "      <td>-2.592997e-01</td>\n",
       "      <td>6.791159e-02</td>\n",
       "      <td>...</td>\n",
       "      <td>-2.617699e-02</td>\n",
       "      <td>2.456376e+00</td>\n",
       "      <td>3.820051e+02</td>\n",
       "      <td>-1.460780e-02</td>\n",
       "      <td>3.615184e+00</td>\n",
       "      <td>5.366087e+02</td>\n",
       "      <td>-9.263066e-03</td>\n",
       "      <td>4.756693e+00</td>\n",
       "      <td>6.940612e+02</td>\n",
       "      <td>-5.167805e-03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>1.871766e+05</td>\n",
       "      <td>6.105792e+05</td>\n",
       "      <td>1.044835e-01</td>\n",
       "      <td>8.657046e-01</td>\n",
       "      <td>2.683330e+01</td>\n",
       "      <td>4.977156e-01</td>\n",
       "      <td>9.999982e-01</td>\n",
       "      <td>4.520661e+01</td>\n",
       "      <td>4.457897e-01</td>\n",
       "      <td>1.153934e+00</td>\n",
       "      <td>...</td>\n",
       "      <td>1.881669e-01</td>\n",
       "      <td>4.852377e+00</td>\n",
       "      <td>4.602630e+02</td>\n",
       "      <td>1.574731e-01</td>\n",
       "      <td>6.993608e+00</td>\n",
       "      <td>6.468768e+02</td>\n",
       "      <td>1.411502e-01</td>\n",
       "      <td>8.871097e+00</td>\n",
       "      <td>8.259981e+02</td>\n",
       "      <td>1.262337e-01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>3.000000e+00</td>\n",
       "      <td>5.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>1.629740e+05</td>\n",
       "      <td>5.284290e+05</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>9.200000e+01</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>1.290000e+02</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>1.730000e+02</td>\n",
       "      <td>0.000000e+00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>3.243260e+05</td>\n",
       "      <td>1.059768e+06</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>3.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>1.100000e+01</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>1.000000e+00</td>\n",
       "      <td>2.340000e+02</td>\n",
       "      <td>1.254705e-03</td>\n",
       "      <td>1.000000e+00</td>\n",
       "      <td>3.260000e+02</td>\n",
       "      <td>2.849003e-03</td>\n",
       "      <td>2.000000e+00</td>\n",
       "      <td>4.270000e+02</td>\n",
       "      <td>3.623188e-03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>4.857900e+05</td>\n",
       "      <td>1.584581e+06</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>1.800000e+01</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>3.700000e+01</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>...</td>\n",
       "      <td>8.219178e-03</td>\n",
       "      <td>3.000000e+00</td>\n",
       "      <td>5.020000e+02</td>\n",
       "      <td>1.034483e-02</td>\n",
       "      <td>4.000000e+00</td>\n",
       "      <td>6.970000e+02</td>\n",
       "      <td>1.155556e-02</td>\n",
       "      <td>6.000000e+00</td>\n",
       "      <td>8.980000e+02</td>\n",
       "      <td>1.200369e-02</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>6.499890e+05</td>\n",
       "      <td>2.114305e+06</td>\n",
       "      <td>1.000000e+00</td>\n",
       "      <td>2.200000e+01</td>\n",
       "      <td>6.560000e+02</td>\n",
       "      <td>1.000000e+00</td>\n",
       "      <td>2.300000e+01</td>\n",
       "      <td>7.210000e+02</td>\n",
       "      <td>1.000000e+00</td>\n",
       "      <td>2.500000e+01</td>\n",
       "      <td>...</td>\n",
       "      <td>1.000000e+00</td>\n",
       "      <td>8.700000e+01</td>\n",
       "      <td>5.049000e+03</td>\n",
       "      <td>1.000000e+00</td>\n",
       "      <td>1.820000e+02</td>\n",
       "      <td>6.614000e+03</td>\n",
       "      <td>1.000000e+00</td>\n",
       "      <td>2.220000e+02</td>\n",
       "      <td>9.476000e+03</td>\n",
       "      <td>1.000000e+00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>8 rows × 33 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                uid        spu_id          type           buy         click  \\\n",
       "count  5.083683e+06  5.083683e+06  5.083683e+06  5.083683e+06  5.083683e+06   \n",
       "mean   3.242576e+05  1.057647e+06  1.103865e-02 -3.064489e-01  1.408126e+01   \n",
       "std    1.871766e+05  6.105792e+05  1.044835e-01  8.657046e-01  2.683330e+01   \n",
       "min    3.000000e+00  5.000000e+00  0.000000e+00 -1.000000e+00 -1.000000e+00   \n",
       "25%    1.629740e+05  5.284290e+05  0.000000e+00 -1.000000e+00 -1.000000e+00   \n",
       "50%    3.243260e+05  1.059768e+06  0.000000e+00  0.000000e+00  3.000000e+00   \n",
       "75%    4.857900e+05  1.584581e+06  0.000000e+00  0.000000e+00  1.800000e+01   \n",
       "max    6.499890e+05  2.114305e+06  1.000000e+00  2.200000e+01  6.560000e+02   \n",
       "\n",
       "            u_ratio         buy_2       click_2     u_ratio_2         buy_3  \\\n",
       "count  5.083683e+06  5.083683e+06  5.083683e+06  5.083683e+06  5.083683e+06   \n",
       "mean  -4.078690e-01 -8.543884e-02  2.788951e+01 -2.592997e-01  6.791159e-02   \n",
       "std    4.977156e-01  9.999982e-01  4.520661e+01  4.457897e-01  1.153934e+00   \n",
       "min   -1.000000e+00 -1.000000e+00 -1.000000e+00 -1.000000e+00 -1.000000e+00   \n",
       "25%   -1.000000e+00 -1.000000e+00 -1.000000e+00 -1.000000e+00  0.000000e+00   \n",
       "50%    0.000000e+00  0.000000e+00  1.100000e+01  0.000000e+00  0.000000e+00   \n",
       "75%    0.000000e+00  0.000000e+00  3.700000e+01  0.000000e+00  0.000000e+00   \n",
       "max    1.000000e+00  2.300000e+01  7.210000e+02  1.000000e+00  2.500000e+01   \n",
       "\n",
       "           ...         u_ratio_21        buy_34      click_34    u_ratio_34  \\\n",
       "count      ...       5.083683e+06  5.083683e+06  5.083683e+06  5.083683e+06   \n",
       "mean       ...      -2.617699e-02  2.456376e+00  3.820051e+02 -1.460780e-02   \n",
       "std        ...       1.881669e-01  4.852377e+00  4.602630e+02  1.574731e-01   \n",
       "min        ...      -1.000000e+00 -1.000000e+00 -1.000000e+00 -1.000000e+00   \n",
       "25%        ...       0.000000e+00  0.000000e+00  9.200000e+01  0.000000e+00   \n",
       "50%        ...       0.000000e+00  1.000000e+00  2.340000e+02  1.254705e-03   \n",
       "75%        ...       8.219178e-03  3.000000e+00  5.020000e+02  1.034483e-02   \n",
       "max        ...       1.000000e+00  8.700000e+01  5.049000e+03  1.000000e+00   \n",
       "\n",
       "             buy_55      click_55    u_ratio_55        buy_89      click_89  \\\n",
       "count  5.083683e+06  5.083683e+06  5.083683e+06  5.083683e+06  5.083683e+06   \n",
       "mean   3.615184e+00  5.366087e+02 -9.263066e-03  4.756693e+00  6.940612e+02   \n",
       "std    6.993608e+00  6.468768e+02  1.411502e-01  8.871097e+00  8.259981e+02   \n",
       "min   -1.000000e+00 -1.000000e+00 -1.000000e+00 -1.000000e+00 -1.000000e+00   \n",
       "25%    0.000000e+00  1.290000e+02  0.000000e+00  0.000000e+00  1.730000e+02   \n",
       "50%    1.000000e+00  3.260000e+02  2.849003e-03  2.000000e+00  4.270000e+02   \n",
       "75%    4.000000e+00  6.970000e+02  1.155556e-02  6.000000e+00  8.980000e+02   \n",
       "max    1.820000e+02  6.614000e+03  1.000000e+00  2.220000e+02  9.476000e+03   \n",
       "\n",
       "         u_ratio_89  \n",
       "count  5.083683e+06  \n",
       "mean  -5.167805e-03  \n",
       "std    1.262337e-01  \n",
       "min   -1.000000e+00  \n",
       "25%    0.000000e+00  \n",
       "50%    3.623188e-03  \n",
       "75%    1.200369e-02  \n",
       "max    1.000000e+00  \n",
       "\n",
       "[8 rows x 33 columns]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>uid</th>\n",
       "      <th>spu_id</th>\n",
       "      <th>type</th>\n",
       "      <th>buy</th>\n",
       "      <th>click</th>\n",
       "      <th>u_ratio</th>\n",
       "      <th>buy_2</th>\n",
       "      <th>click_2</th>\n",
       "      <th>u_ratio_2</th>\n",
       "      <th>buy_3</th>\n",
       "      <th>...</th>\n",
       "      <th>u_ratio_21</th>\n",
       "      <th>buy_34</th>\n",
       "      <th>click_34</th>\n",
       "      <th>u_ratio_34</th>\n",
       "      <th>buy_55</th>\n",
       "      <th>click_55</th>\n",
       "      <th>u_ratio_55</th>\n",
       "      <th>buy_89</th>\n",
       "      <th>click_89</th>\n",
       "      <th>u_ratio_89</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>5.331337e+06</td>\n",
       "      <td>5.331337e+06</td>\n",
       "      <td>5.331337e+06</td>\n",
       "      <td>5.331337e+06</td>\n",
       "      <td>5.331337e+06</td>\n",
       "      <td>5.331337e+06</td>\n",
       "      <td>5.331337e+06</td>\n",
       "      <td>5.331337e+06</td>\n",
       "      <td>5.331337e+06</td>\n",
       "      <td>5.331337e+06</td>\n",
       "      <td>...</td>\n",
       "      <td>5.331337e+06</td>\n",
       "      <td>5.331337e+06</td>\n",
       "      <td>5.331337e+06</td>\n",
       "      <td>5.331337e+06</td>\n",
       "      <td>5.331337e+06</td>\n",
       "      <td>5.331337e+06</td>\n",
       "      <td>5.331337e+06</td>\n",
       "      <td>5.331337e+06</td>\n",
       "      <td>5.331337e+06</td>\n",
       "      <td>5.331337e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>3.253177e+05</td>\n",
       "      <td>1.057858e+06</td>\n",
       "      <td>1.096704e-02</td>\n",
       "      <td>-3.530660e-01</td>\n",
       "      <td>1.293366e+01</td>\n",
       "      <td>-4.343849e-01</td>\n",
       "      <td>-1.320016e-01</td>\n",
       "      <td>2.560382e+01</td>\n",
       "      <td>-2.877686e-01</td>\n",
       "      <td>3.133342e-02</td>\n",
       "      <td>...</td>\n",
       "      <td>-2.683220e-02</td>\n",
       "      <td>1.925354e+00</td>\n",
       "      <td>2.989199e+02</td>\n",
       "      <td>-2.275038e-02</td>\n",
       "      <td>3.298222e+00</td>\n",
       "      <td>4.972473e+02</td>\n",
       "      <td>-1.232190e-02</td>\n",
       "      <td>4.577987e+00</td>\n",
       "      <td>6.660825e+02</td>\n",
       "      <td>-7.605803e-03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>1.875326e+05</td>\n",
       "      <td>6.102542e+05</td>\n",
       "      <td>1.041478e-01</td>\n",
       "      <td>8.112605e-01</td>\n",
       "      <td>2.666648e+01</td>\n",
       "      <td>5.006426e-01</td>\n",
       "      <td>9.687068e-01</td>\n",
       "      <td>4.375965e+01</td>\n",
       "      <td>4.597426e-01</td>\n",
       "      <td>1.172049e+00</td>\n",
       "      <td>...</td>\n",
       "      <td>1.916182e-01</td>\n",
       "      <td>3.998331e+00</td>\n",
       "      <td>3.718557e+02</td>\n",
       "      <td>1.811016e-01</td>\n",
       "      <td>6.268284e+00</td>\n",
       "      <td>6.093351e+02</td>\n",
       "      <td>1.515001e-01</td>\n",
       "      <td>8.434140e+00</td>\n",
       "      <td>8.069819e+02</td>\n",
       "      <td>1.361281e-01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>3.000000e+00</td>\n",
       "      <td>2.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>1.635880e+05</td>\n",
       "      <td>5.290100e+05</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>6.800000e+01</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>1.170000e+02</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>1.590000e+02</td>\n",
       "      <td>0.000000e+00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>3.256190e+05</td>\n",
       "      <td>1.062819e+06</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>2.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>9.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>1.820000e+02</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>1.000000e+00</td>\n",
       "      <td>3.010000e+02</td>\n",
       "      <td>2.481390e-03</td>\n",
       "      <td>2.000000e+00</td>\n",
       "      <td>4.030000e+02</td>\n",
       "      <td>3.496503e-03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>4.873600e+05</td>\n",
       "      <td>1.585468e+06</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>1.600000e+01</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>3.400000e+01</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>...</td>\n",
       "      <td>9.216590e-03</td>\n",
       "      <td>2.000000e+00</td>\n",
       "      <td>3.920000e+02</td>\n",
       "      <td>9.575923e-03</td>\n",
       "      <td>4.000000e+00</td>\n",
       "      <td>6.460000e+02</td>\n",
       "      <td>1.117318e-02</td>\n",
       "      <td>6.000000e+00</td>\n",
       "      <td>8.630000e+02</td>\n",
       "      <td>1.190476e-02</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>6.499970e+05</td>\n",
       "      <td>2.114305e+06</td>\n",
       "      <td>1.000000e+00</td>\n",
       "      <td>1.800000e+01</td>\n",
       "      <td>4.810000e+02</td>\n",
       "      <td>1.000000e+00</td>\n",
       "      <td>2.100000e+01</td>\n",
       "      <td>9.600000e+02</td>\n",
       "      <td>1.000000e+00</td>\n",
       "      <td>2.600000e+01</td>\n",
       "      <td>...</td>\n",
       "      <td>1.000000e+00</td>\n",
       "      <td>9.700000e+01</td>\n",
       "      <td>4.009000e+03</td>\n",
       "      <td>1.000000e+00</td>\n",
       "      <td>1.480000e+02</td>\n",
       "      <td>6.345000e+03</td>\n",
       "      <td>1.000000e+00</td>\n",
       "      <td>2.120000e+02</td>\n",
       "      <td>8.637000e+03</td>\n",
       "      <td>1.000000e+00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>8 rows × 33 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                uid        spu_id          type           buy         click  \\\n",
       "count  5.331337e+06  5.331337e+06  5.331337e+06  5.331337e+06  5.331337e+06   \n",
       "mean   3.253177e+05  1.057858e+06  1.096704e-02 -3.530660e-01  1.293366e+01   \n",
       "std    1.875326e+05  6.102542e+05  1.041478e-01  8.112605e-01  2.666648e+01   \n",
       "min    3.000000e+00  2.000000e+00  0.000000e+00 -1.000000e+00 -1.000000e+00   \n",
       "25%    1.635880e+05  5.290100e+05  0.000000e+00 -1.000000e+00 -1.000000e+00   \n",
       "50%    3.256190e+05  1.062819e+06  0.000000e+00  0.000000e+00  2.000000e+00   \n",
       "75%    4.873600e+05  1.585468e+06  0.000000e+00  0.000000e+00  1.600000e+01   \n",
       "max    6.499970e+05  2.114305e+06  1.000000e+00  1.800000e+01  4.810000e+02   \n",
       "\n",
       "            u_ratio         buy_2       click_2     u_ratio_2         buy_3  \\\n",
       "count  5.331337e+06  5.331337e+06  5.331337e+06  5.331337e+06  5.331337e+06   \n",
       "mean  -4.343849e-01 -1.320016e-01  2.560382e+01 -2.877686e-01  3.133342e-02   \n",
       "std    5.006426e-01  9.687068e-01  4.375965e+01  4.597426e-01  1.172049e+00   \n",
       "min   -1.000000e+00 -1.000000e+00 -1.000000e+00 -1.000000e+00 -1.000000e+00   \n",
       "25%   -1.000000e+00 -1.000000e+00 -1.000000e+00 -1.000000e+00  0.000000e+00   \n",
       "50%    0.000000e+00  0.000000e+00  9.000000e+00  0.000000e+00  0.000000e+00   \n",
       "75%    0.000000e+00  0.000000e+00  3.400000e+01  0.000000e+00  0.000000e+00   \n",
       "max    1.000000e+00  2.100000e+01  9.600000e+02  1.000000e+00  2.600000e+01   \n",
       "\n",
       "           ...         u_ratio_21        buy_34      click_34    u_ratio_34  \\\n",
       "count      ...       5.331337e+06  5.331337e+06  5.331337e+06  5.331337e+06   \n",
       "mean       ...      -2.683220e-02  1.925354e+00  2.989199e+02 -2.275038e-02   \n",
       "std        ...       1.916182e-01  3.998331e+00  3.718557e+02  1.811016e-01   \n",
       "min        ...      -1.000000e+00 -1.000000e+00 -1.000000e+00 -1.000000e+00   \n",
       "25%        ...       0.000000e+00  0.000000e+00  6.800000e+01  0.000000e+00   \n",
       "50%        ...       0.000000e+00  0.000000e+00  1.820000e+02  0.000000e+00   \n",
       "75%        ...       9.216590e-03  2.000000e+00  3.920000e+02  9.575923e-03   \n",
       "max        ...       1.000000e+00  9.700000e+01  4.009000e+03  1.000000e+00   \n",
       "\n",
       "             buy_55      click_55    u_ratio_55        buy_89      click_89  \\\n",
       "count  5.331337e+06  5.331337e+06  5.331337e+06  5.331337e+06  5.331337e+06   \n",
       "mean   3.298222e+00  4.972473e+02 -1.232190e-02  4.577987e+00  6.660825e+02   \n",
       "std    6.268284e+00  6.093351e+02  1.515001e-01  8.434140e+00  8.069819e+02   \n",
       "min   -1.000000e+00 -1.000000e+00 -1.000000e+00 -1.000000e+00 -1.000000e+00   \n",
       "25%    0.000000e+00  1.170000e+02  0.000000e+00  0.000000e+00  1.590000e+02   \n",
       "50%    1.000000e+00  3.010000e+02  2.481390e-03  2.000000e+00  4.030000e+02   \n",
       "75%    4.000000e+00  6.460000e+02  1.117318e-02  6.000000e+00  8.630000e+02   \n",
       "max    1.480000e+02  6.345000e+03  1.000000e+00  2.120000e+02  8.637000e+03   \n",
       "\n",
       "         u_ratio_89  \n",
       "count  5.331337e+06  \n",
       "mean  -7.605803e-03  \n",
       "std    1.361281e-01  \n",
       "min   -1.000000e+00  \n",
       "25%    0.000000e+00  \n",
       "50%    3.496503e-03  \n",
       "75%    1.190476e-02  \n",
       "max    1.000000e+00  \n",
       "\n",
       "[8 rows x 33 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#正例\n",
    "train_postive = train[train['type'] == 1]\n",
    "#负例\n",
    "train_negative = train[train['type'] == 0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "del train\n",
    "# print train_postive[:2]\n",
    "# print train_negative[:2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(5027566, 56117)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(train_negative) , len(train_postive)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4022052"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sampler = np.random.randint(0,len(train_negative), size = int(len(train_negative)*0.8))\n",
    "len(sampler)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "train = pd.concat([train_postive,train_postive,train_postive,train_postive, train_negative.take(sampler),train_postive,train_postive,train_postive,train_postive],axis=0,ignore_index=True)\n",
    "del sampler"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "del train_negative\n",
    "del train_postive"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "train_label = train['type']\n",
    "test_label = test['type']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "train = train.drop(['uid', 'spu_id', 'type','date'],axis =1) \n",
    "test = test.drop(['uid', 'spu_id', 'type','date'],axis=1) \n",
    "# train = train[['click_5','buy_5','u_ratio_5','click_55','buy_55','u_ratio_55']] \n",
    "# test = test[['click_5','buy_5','u_ratio_5','click_55','buy_55','u_ratio_55']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>uiclick_3</th>\n",
       "      <th>uibuy_3</th>\n",
       "      <th>ui_ratio_3</th>\n",
       "      <th>uiclick_8</th>\n",
       "      <th>uibuy_8</th>\n",
       "      <th>ui_ratio_8</th>\n",
       "      <th>uiclick_21</th>\n",
       "      <th>uibuy_21</th>\n",
       "      <th>ui_ratio_21</th>\n",
       "      <th>uiclick_34</th>\n",
       "      <th>...</th>\n",
       "      <th>ub_ratio_8</th>\n",
       "      <th>ubbuy_21</th>\n",
       "      <th>ubclick_21</th>\n",
       "      <th>ub_ratio_21</th>\n",
       "      <th>ubbuy_34</th>\n",
       "      <th>ubclick_34</th>\n",
       "      <th>ub_ratio_34</th>\n",
       "      <th>ubbuy_89</th>\n",
       "      <th>ubclick_89</th>\n",
       "      <th>ub_ratio_89</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>23.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>23.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>23.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>0.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 75 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   uiclick_3  uibuy_3  ui_ratio_3  uiclick_8  uibuy_8  ui_ratio_8  uiclick_21  \\\n",
       "0        1.0      0.0         0.0        2.0      0.0         0.0         2.0   \n",
       "1       -1.0     -1.0        -1.0       -1.0     -1.0        -1.0         1.0   \n",
       "2       -1.0     -1.0        -1.0       -1.0     -1.0        -1.0        -1.0   \n",
       "3       -1.0     -1.0        -1.0       -1.0     -1.0        -1.0        -1.0   \n",
       "4       -1.0     -1.0        -1.0       -1.0     -1.0        -1.0        -1.0   \n",
       "\n",
       "   uibuy_21  ui_ratio_21  uiclick_34     ...       ub_ratio_8  ubbuy_21  \\\n",
       "0       0.0          0.0         2.0     ...              0.0       0.0   \n",
       "1       0.0          0.0         2.0     ...             -1.0       0.0   \n",
       "2      -1.0         -1.0        -1.0     ...             -1.0      -1.0   \n",
       "3      -1.0         -1.0        -1.0     ...              0.0       0.0   \n",
       "4      -1.0         -1.0        -1.0     ...             -1.0      -1.0   \n",
       "\n",
       "   ubclick_21  ub_ratio_21  ubbuy_34  ubclick_34  ub_ratio_34  ubbuy_89  \\\n",
       "0        23.0          0.0       0.0        23.0          0.0       0.0   \n",
       "1         4.0          0.0       0.0         9.0          0.0       1.0   \n",
       "2        -1.0         -1.0      -1.0        -1.0         -1.0      -1.0   \n",
       "3         6.0          0.0       0.0         6.0          0.0       0.0   \n",
       "4        -1.0         -1.0      -1.0        -1.0         -1.0      -1.0   \n",
       "\n",
       "   ubclick_89  ub_ratio_89  \n",
       "0        23.0          0.0  \n",
       "1        10.0          0.1  \n",
       "2        -1.0         -1.0  \n",
       "3         6.0          0.0  \n",
       "4        -1.0         -1.0  \n",
       "\n",
       "[5 rows x 75 columns]"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>uiclick_3</th>\n",
       "      <th>uibuy_3</th>\n",
       "      <th>ui_ratio_3</th>\n",
       "      <th>uiclick_8</th>\n",
       "      <th>uibuy_8</th>\n",
       "      <th>ui_ratio_8</th>\n",
       "      <th>uiclick_21</th>\n",
       "      <th>uibuy_21</th>\n",
       "      <th>ui_ratio_21</th>\n",
       "      <th>uiclick_34</th>\n",
       "      <th>...</th>\n",
       "      <th>ub_ratio_8</th>\n",
       "      <th>ubbuy_21</th>\n",
       "      <th>ubclick_21</th>\n",
       "      <th>ub_ratio_21</th>\n",
       "      <th>ubbuy_34</th>\n",
       "      <th>ubclick_34</th>\n",
       "      <th>ub_ratio_34</th>\n",
       "      <th>ubbuy_89</th>\n",
       "      <th>ubclick_89</th>\n",
       "      <th>ub_ratio_89</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>44.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>44.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>141.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>69.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 75 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   uiclick_3  uibuy_3  ui_ratio_3  uiclick_8  uibuy_8  ui_ratio_8  uiclick_21  \\\n",
       "0       -1.0     -1.0        -1.0       -1.0     -1.0        -1.0        -1.0   \n",
       "1       -1.0     -1.0        -1.0       -1.0     -1.0        -1.0        -1.0   \n",
       "2       -1.0     -1.0        -1.0       -1.0     -1.0        -1.0        -1.0   \n",
       "3       -1.0     -1.0        -1.0       -1.0     -1.0        -1.0        -1.0   \n",
       "4       -1.0     -1.0        -1.0       -1.0     -1.0        -1.0        -1.0   \n",
       "\n",
       "   uibuy_21  ui_ratio_21  uiclick_34     ...       ub_ratio_8  ubbuy_21  \\\n",
       "0      -1.0         -1.0        -1.0     ...             -1.0      -1.0   \n",
       "1      -1.0         -1.0        -1.0     ...             -1.0       0.0   \n",
       "2      -1.0         -1.0        -1.0     ...              0.0       0.0   \n",
       "3      -1.0         -1.0        -1.0     ...              0.0       0.0   \n",
       "4      -1.0         -1.0        -1.0     ...             -1.0      -1.0   \n",
       "\n",
       "   ubclick_21  ub_ratio_21  ubbuy_34  ubclick_34  ub_ratio_34  ubbuy_89  \\\n",
       "0        -1.0         -1.0      -1.0        -1.0         -1.0      -1.0   \n",
       "1         5.0          0.0       0.0         5.0          0.0       0.0   \n",
       "2        44.0          0.0       0.0        44.0          0.0       0.0   \n",
       "3        52.0          0.0       0.0        52.0          0.0       0.0   \n",
       "4        -1.0         -1.0      -1.0        -1.0         -1.0      -1.0   \n",
       "\n",
       "   ubclick_89  ub_ratio_89  \n",
       "0        -1.0         -1.0  \n",
       "1         5.0          0.0  \n",
       "2       141.0          0.0  \n",
       "3        69.0          0.0  \n",
       "4        -1.0         -1.0  \n",
       "\n",
       "[5 rows x 75 columns]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1 1 1 ..., 1 1 1]\n",
      "[0 0 0 ..., 0 0 0]\n"
     ]
    }
   ],
   "source": [
    "print train_label.values\n",
    "print test_label.values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "dtrain = xgb.DMatrix(train, train_label)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "del train,train_label"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "dtrain.save_binary('cache/off_train.buffer')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "dtest = xgb.DMatrix(test,test_label)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "del test,test_label"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "dtest.save_binary('cache/off_test.buffer')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# 自定义的评价函数:概率的均方误差\n",
    "def  eval_avg_sqt( preds, dtrain ):\n",
    "    label = dtrain.get_label()\n",
    "    #label = dtrain\n",
    "    error = np.sqrt(np.square(label - preds).sum()*1.0/len(label))\n",
    "    return  'FSCORE',float(error)\n",
    "\n",
    "# 自定义的评价函数: precision and recall\n",
    "def eval_customedscore(preds, dtrain):\n",
    "    label = dtrain.get_label()\n",
    "    p_label = np.where(preds > 0.5, 1, 0)\n",
    "    confusion_matrixs = metrics.confusion_matrix(label, p_label)\n",
    "    recall = float(confusion_matrixs[0][0]) / float(confusion_matrixs[0][1]+ confusion_matrixs[0][0])\n",
    "    precision = float(confusion_matrixs[0][0]) / float(confusion_matrixs[1][0]+confusion_matrixs[0][0])\n",
    "    F = precision* recall/(precision+recall)     \n",
    "    return 'FSCORE',float(F)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ 0.04631035  0.14725082  0.04532608 ...,  0.09429498  0.40703386\n",
      "  0.04397944]\n"
     ]
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0]\tval-auc:0.769076\ttrain-auc:0.784511\tval-FSCORE:0.38218\ttrain-FSCORE:0.404408\n",
      "Multiple eval metrics have been passed: 'train-FSCORE' will be used for early stopping.\n",
      "\n",
      "Will train until train-FSCORE hasn't improved in 10 rounds.\n",
      "[1]\tval-auc:0.786938\ttrain-auc:0.802865\tval-FSCORE:0.304884\ttrain-FSCORE:0.348623\n",
      "[2]\tval-auc:0.789555\ttrain-auc:0.805532\tval-FSCORE:0.252914\ttrain-FSCORE:0.316103\n",
      "[3]\tval-auc:0.791442\ttrain-auc:0.807742\tval-FSCORE:0.21808\ttrain-FSCORE:0.297663\n",
      "[4]\tval-auc:0.792161\ttrain-auc:0.808514\tval-FSCORE:0.194818\ttrain-FSCORE:0.287281\n",
      "[5]\tval-auc:0.793173\ttrain-auc:0.809549\tval-FSCORE:0.179412\ttrain-FSCORE:0.281485\n",
      "[6]\tval-auc:0.795949\ttrain-auc:0.812128\tval-FSCORE:0.169446\ttrain-FSCORE:0.278161\n",
      "[7]\tval-auc:0.798563\ttrain-auc:0.814107\tval-FSCORE:0.16307\ttrain-FSCORE:0.276376\n",
      "[8]\tval-auc:0.801416\ttrain-auc:0.816654\tval-FSCORE:0.158786\ttrain-FSCORE:0.27514\n",
      "[9]\tval-auc:0.801747\ttrain-auc:0.817634\tval-FSCORE:0.155888\ttrain-FSCORE:0.274418\n",
      "[10]\tval-auc:0.804092\ttrain-auc:0.820067\tval-FSCORE:0.154033\ttrain-FSCORE:0.273835\n",
      "[11]\tval-auc:0.804797\ttrain-auc:0.820775\tval-FSCORE:0.153015\ttrain-FSCORE:0.273412\n",
      "[12]\tval-auc:0.806796\ttrain-auc:0.822669\tval-FSCORE:0.152009\ttrain-FSCORE:0.273149\n",
      "[13]\tval-auc:0.807893\ttrain-auc:0.823794\tval-FSCORE:0.1515\ttrain-FSCORE:0.272821\n",
      "[14]\tval-auc:0.808932\ttrain-auc:0.824748\tval-FSCORE:0.150979\ttrain-FSCORE:0.272545\n",
      "[15]\tval-auc:0.809596\ttrain-auc:0.825675\tval-FSCORE:0.151027\ttrain-FSCORE:0.272421\n",
      "[16]\tval-auc:0.810191\ttrain-auc:0.826347\tval-FSCORE:0.151004\ttrain-FSCORE:0.272274\n",
      "[17]\tval-auc:0.810805\ttrain-auc:0.826998\tval-FSCORE:0.15129\ttrain-FSCORE:0.272102\n",
      "[18]\tval-auc:0.811776\ttrain-auc:0.827677\tval-FSCORE:0.151702\ttrain-FSCORE:0.271972\n",
      "[19]\tval-auc:0.812323\ttrain-auc:0.828188\tval-FSCORE:0.151783\ttrain-FSCORE:0.271875\n",
      "[20]\tval-auc:0.812575\ttrain-auc:0.828517\tval-FSCORE:0.151882\ttrain-FSCORE:0.27179\n"
     ]
    },
    {
     "ename": "KeyboardInterrupt",
     "evalue": "",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m\u001b[0m",
      "\u001b[0;31mKeyboardInterrupt\u001b[0mTraceback (most recent call last)",
      "\u001b[0;32m<ipython-input-31-adca3900215b>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m     17\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m     18\u001b[0m \u001b[0mt0\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mtime\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtime\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m---> 19\u001b[0;31m \u001b[0mmodel\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mxgb\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtrain\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mparams\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mdtrain\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mnum_boost_round\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m53\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mevals\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mevallist\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mearly_stopping_rounds\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m10\u001b[0m \u001b[1;33m,\u001b[0m\u001b[0mfeval\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0meval_avg_sqt\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     20\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[0mtime\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtime\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m-\u001b[0m \u001b[0mt0\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m     21\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[0;32mD:\\myProgramFiles\\Anaconda2\\lib\\site-packages\\xgboost-0.6-py2.7.egg\\xgboost\\training.pyc\u001b[0m in \u001b[0;36mtrain\u001b[0;34m(params, dtrain, num_boost_round, evals, obj, feval, maximize, early_stopping_rounds, evals_result, verbose_eval, xgb_model, callbacks, learning_rates)\u001b[0m\n\u001b[1;32m    202\u001b[0m                            \u001b[0mevals\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mevals\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m    203\u001b[0m                            \u001b[0mobj\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mobj\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mfeval\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mfeval\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m--> 204\u001b[0;31m                            xgb_model=xgb_model, callbacks=callbacks)\n\u001b[0m\u001b[1;32m    205\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m    206\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[0;32mD:\\myProgramFiles\\Anaconda2\\lib\\site-packages\\xgboost-0.6-py2.7.egg\\xgboost\\training.pyc\u001b[0m in \u001b[0;36m_train_internal\u001b[0;34m(params, dtrain, num_boost_round, evals, obj, feval, xgb_model, callbacks)\u001b[0m\n\u001b[1;32m     72\u001b[0m         \u001b[1;31m# Skip the first update if it is a recovery step.\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m     73\u001b[0m         \u001b[1;32mif\u001b[0m \u001b[0mversion\u001b[0m \u001b[1;33m%\u001b[0m \u001b[1;36m2\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;36m0\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m---> 74\u001b[0;31m             \u001b[0mbst\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mupdate\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdtrain\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mi\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mobj\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     75\u001b[0m             \u001b[0mbst\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msave_rabit_checkpoint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m     76\u001b[0m             \u001b[0mversion\u001b[0m \u001b[1;33m+=\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[0;32mD:\\myProgramFiles\\Anaconda2\\lib\\site-packages\\xgboost-0.6-py2.7.egg\\xgboost\\core.pyc\u001b[0m in \u001b[0;36mupdate\u001b[0;34m(self, dtrain, iteration, fobj)\u001b[0m\n\u001b[1;32m    817\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m    818\u001b[0m         \u001b[1;32mif\u001b[0m \u001b[0mfobj\u001b[0m \u001b[1;32mis\u001b[0m \u001b[0mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m--> 819\u001b[0;31m             \u001b[0m_check_call\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0m_LIB\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mXGBoosterUpdateOneIter\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mhandle\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0miteration\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtrain\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mhandle\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    820\u001b[0m         \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m    821\u001b[0m             \u001b[0mpred\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mpredict\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdtrain\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mKeyboardInterrupt\u001b[0m: "
     ]
    }
   ],
   "source": [
    "params = {        \n",
    "            'max_depth':3,\n",
    "            'min_child_weight':3,\n",
    "            'eta':0.3,\n",
    "            'subsample':1,\n",
    "            'colsample_bytree':1,\n",
    "            'scale_pos_weight':1,\n",
    "            'max_delta_step': 0,\n",
    "            'eval_metric':'auc',\n",
    "            'lambda' :0,\n",
    "            'alpha': 0,\n",
    "            'gamma': 1,\n",
    "            'seed': 1,\n",
    "            'objective':'binary:logistic',\n",
    "}\n",
    "evallist = [ (dtest, 'val'), (dtrain, 'train')]\n",
    "\n",
    "t0 = time.time()\n",
    "model = xgb.train(params,dtrain,num_boost_round=53,evals = evallist, early_stopping_rounds=10 ,feval=eval_avg_sqt)\n",
    "print time.time() - t0\n",
    "\n",
    "model.best_score,model.best_iteration,model.best_ntree_limit"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x768ec208>"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAfcAAAFYCAYAAABOP7UcAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0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II4OKigpaW1s5e/as5TJITk4mOTnZ+3/Bip8DI4Njx45Z9nMwb948mpqa\nsNlslv0cgEk6d4ej/QZE57XsrWDJkiUsW7aM5uZmAGw2Wx8fUeCNGzcOh8Ph/RwEBQUB7VlYJQ8j\ng3Xr1pGUlOT9kmelDDweD3l5eZb+HBgZ7N+/37Kfg+LiYlatWmXpzwGYpHOPjo4mKyvLcrfkAfLy\n8nC5XPTr1499+/aRkJDQ14fUZ9ra2ti3bx+pqal89NFH1NfX069fv74+rIByuVx88MEHPPnkk5bL\n4KWXXgLa97Sw6ufAyGD9+vWW/RwcPXqUN954g5CQEMt+DkDLz4qIiJiOKa7cRURE5Evq3EVERExG\nnbuIiIjJqHMXERExGVMsYiMivWPTpk3eqUSpqamWWyBJ5G6lzl1EbsnhcDB48GBvx75x40aCgoL4\n3ve+x5///GdaWlp4+OGH+fvf/05zczNJSUnk5eWxcOFCjhw5QltbGz/96U8tNcdYpK/ptryI3NLy\n5ct58sknvb+PGjUKt9tNeXk5Q4YMYeXKlRw9epSf/OQnxMTEUFNTw7e//W2OHz9OeHg4breb2tra\nPjwDEetR5y4iPVJaWkpISAgtLS1cvHiRV199lenTp5ORkUFFRQURERHY7XYSExOpqamhf//+hIeH\n9/Vhi1iKFrERERExGV25i4iImIw6dxEREZNR5y4iImIy6txFRERMRp27iIiIyahzFxERMRl17iIi\nIibz/7F+Ux9Eho/fAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x768e16d8>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%matplotlib inline\n",
    "import seaborn as sns\n",
    "sns.set(font_scale = 0.5)\n",
    "xgb.plot_importance(model)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.099818951764003919"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0]\tval-auc:0.769076\ttrain-auc:0.784511\tval-FSCORE:0.38218\ttrain-FSCORE:0.404408\n",
      "Multiple eval metrics have been passed: 'train-FSCORE' will be used for early stopping.\n",
      "\n",
      "Will train until train-FSCORE hasn't improved in 10 rounds.\n",
      "[1]\tval-auc:0.786938\ttrain-auc:0.802865\tval-FSCORE:0.304884\ttrain-FSCORE:0.348623\n",
      "[2]\tval-auc:0.789555\ttrain-auc:0.805532\tval-FSCORE:0.252914\ttrain-FSCORE:0.316103\n",
      "[3]\tval-auc:0.791442\ttrain-auc:0.807742\tval-FSCORE:0.21808\ttrain-FSCORE:0.297663\n",
      "[4]\tval-auc:0.792161\ttrain-auc:0.808514\tval-FSCORE:0.194818\ttrain-FSCORE:0.287281\n",
      "[5]\tval-auc:0.793173\ttrain-auc:0.809549\tval-FSCORE:0.179412\ttrain-FSCORE:0.281485\n",
      "[6]\tval-auc:0.795949\ttrain-auc:0.812128\tval-FSCORE:0.169446\ttrain-FSCORE:0.278161\n",
      "[7]\tval-auc:0.798563\ttrain-auc:0.814107\tval-FSCORE:0.16307\ttrain-FSCORE:0.276376\n",
      "[8]\tval-auc:0.801416\ttrain-auc:0.816654\tval-FSCORE:0.158786\ttrain-FSCORE:0.27514\n",
      "[9]\tval-auc:0.801747\ttrain-auc:0.817634\tval-FSCORE:0.155888\ttrain-FSCORE:0.274418\n",
      "[10]\tval-auc:0.804092\ttrain-auc:0.820067\tval-FSCORE:0.154033\ttrain-FSCORE:0.273835\n",
      "[11]\tval-auc:0.804797\ttrain-auc:0.820775\tval-FSCORE:0.153015\ttrain-FSCORE:0.273412\n",
      "[12]\tval-auc:0.806796\ttrain-auc:0.822669\tval-FSCORE:0.152009\ttrain-FSCORE:0.273149\n",
      "[13]\tval-auc:0.807893\ttrain-auc:0.823794\tval-FSCORE:0.1515\ttrain-FSCORE:0.272821\n",
      "[14]\tval-auc:0.808932\ttrain-auc:0.824748\tval-FSCORE:0.150979\ttrain-FSCORE:0.272545\n",
      "[15]\tval-auc:0.809596\ttrain-auc:0.825675\tval-FSCORE:0.151027\ttrain-FSCORE:0.272421\n",
      "[16]\tval-auc:0.810191\ttrain-auc:0.826347\tval-FSCORE:0.151004\ttrain-FSCORE:0.272274\n",
      "[17]\tval-auc:0.810805\ttrain-auc:0.826998\tval-FSCORE:0.15129\ttrain-FSCORE:0.272102\n",
      "[18]\tval-auc:0.811776\ttrain-auc:0.827677\tval-FSCORE:0.151702\ttrain-FSCORE:0.271972\n",
      "[19]\tval-auc:0.812323\ttrain-auc:0.828188\tval-FSCORE:0.151783\ttrain-FSCORE:0.271875\n",
      "[20]\tval-auc:0.812575\ttrain-auc:0.828517\tval-FSCORE:0.151882\ttrain-FSCORE:0.27179\n",
      "[21]\tval-auc:0.812824\ttrain-auc:0.828909\tval-FSCORE:0.152241\ttrain-FSCORE:0.27172\n",
      "[22]\tval-auc:0.812869\ttrain-auc:0.829002\tval-FSCORE:0.152691\ttrain-FSCORE:0.271632\n",
      "[23]\tval-auc:0.81322\ttrain-auc:0.829301\tval-FSCORE:0.152736\ttrain-FSCORE:0.271565\n",
      "[24]\tval-auc:0.813388\ttrain-auc:0.829518\tval-FSCORE:0.152641\ttrain-FSCORE:0.271492\n",
      "[25]\tval-auc:0.813532\ttrain-auc:0.829719\tval-FSCORE:0.152831\ttrain-FSCORE:0.271451\n"
     ]
    },
    {
     "ename": "KeyboardInterrupt",
     "evalue": "",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m\u001b[0m",
      "\u001b[0;31mKeyboardInterrupt\u001b[0mTraceback (most recent call last)",
      "\u001b[0;32m<ipython-input-28-b8341f984f72>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m     17\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m     18\u001b[0m \u001b[0mt0\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mtime\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtime\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m---> 19\u001b[0;31m \u001b[0mmodel\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mxgb\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtrain\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mparams\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mdtrain\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mnum_boost_round\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m53\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mevals\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mevallist\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mearly_stopping_rounds\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m10\u001b[0m \u001b[1;33m,\u001b[0m\u001b[0mfeval\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0meval_avg_sqt\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     20\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[0mtime\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtime\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m-\u001b[0m \u001b[0mt0\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m     21\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[0;32mD:\\myProgramFiles\\Anaconda2\\lib\\site-packages\\xgboost-0.6-py2.7.egg\\xgboost\\training.pyc\u001b[0m in \u001b[0;36mtrain\u001b[0;34m(params, dtrain, num_boost_round, evals, obj, feval, maximize, early_stopping_rounds, evals_result, verbose_eval, xgb_model, callbacks, learning_rates)\u001b[0m\n\u001b[1;32m    202\u001b[0m                            \u001b[0mevals\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mevals\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m    203\u001b[0m                            \u001b[0mobj\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mobj\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mfeval\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mfeval\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m--> 204\u001b[0;31m                            xgb_model=xgb_model, callbacks=callbacks)\n\u001b[0m\u001b[1;32m    205\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m    206\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[0;32mD:\\myProgramFiles\\Anaconda2\\lib\\site-packages\\xgboost-0.6-py2.7.egg\\xgboost\\training.pyc\u001b[0m in \u001b[0;36m_train_internal\u001b[0;34m(params, dtrain, num_boost_round, evals, obj, feval, xgb_model, callbacks)\u001b[0m\n\u001b[1;32m     82\u001b[0m         \u001b[1;31m# check evaluation result.\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m     83\u001b[0m         \u001b[1;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mevals\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m!=\u001b[0m \u001b[1;36m0\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m---> 84\u001b[0;31m             \u001b[0mbst_eval_set\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mbst\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0meval_set\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mevals\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mi\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mfeval\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     85\u001b[0m             \u001b[1;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mbst_eval_set\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mSTRING_TYPES\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m     86\u001b[0m                 \u001b[0mmsg\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mbst_eval_set\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[0;32mD:\\myProgramFiles\\Anaconda2\\lib\\site-packages\\xgboost-0.6-py2.7.egg\\xgboost\\core.pyc\u001b[0m in \u001b[0;36meval_set\u001b[0;34m(self, evals, iteration, feval)\u001b[0m\n\u001b[1;32m    877\u001b[0m         _check_call(_LIB.XGBoosterEvalOneIter(self.handle, iteration,\n\u001b[1;32m    878\u001b[0m                                               \u001b[0mdmats\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mevnames\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mevals\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m--> 879\u001b[0;31m                                               ctypes.byref(msg)))\n\u001b[0m\u001b[1;32m    880\u001b[0m         \u001b[0mres\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mmsg\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mvalue\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdecode\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m    881\u001b[0m         \u001b[1;32mif\u001b[0m \u001b[0mfeval\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[0mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mKeyboardInterrupt\u001b[0m: "
     ]
    }
   ],
   "source": [
    "params = {        \n",
    "            'max_depth':3,\n",
    "            'min_child_weight':3,\n",
    "            'eta':0.3,\n",
    "            'subsample':1,\n",
    "            'colsample_bytree':1,\n",
    "            'scale_pos_weight':1,\n",
    "            'max_delta_step': 0,\n",
    "            'eval_metric':'auc',\n",
    "            'lambda' :0,\n",
    "            'alpha': 0,\n",
    "            'gamma': 0,\n",
    "            'seed': 1,\n",
    "            'objective':'binary:logistic',\n",
    "}\n",
    "evallist = [ (dtest, 'val'), (dtrain, 'train')]\n",
    "\n",
    "t0 = time.time()\n",
    "model = xgb.train(params,dtrain,num_boost_round=53,evals = evallist, early_stopping_rounds=10 ,feval=eval_avg_sqt)\n",
    "print time.time() - t0\n",
    "\n",
    "model.best_score,model.best_iteration,model.best_ntree_limit"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4022052\n",
      "4218294\n"
     ]
    },
    {
     "ename": "MemoryError",
     "evalue": "",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m\u001b[0m",
      "\u001b[0;31mMemoryError\u001b[0mTraceback (most recent call last)",
      "\u001b[0;32m<ipython-input-7-7e4a8b77c42b>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m     13\u001b[0m \u001b[0mtest_label\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mtest\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'type'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m     14\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m---> 15\u001b[0;31m \u001b[0mtrain\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mtrain\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdrop\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'uid'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'spu_id'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'type'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m'date'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0maxis\u001b[0m \u001b[1;33m=\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     16\u001b[0m \u001b[0mtest\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mtest\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdrop\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'uid'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'spu_id'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'type'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m'date'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0maxis\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m     17\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[0;32mD:\\myProgramFiles\\Anaconda2\\lib\\site-packages\\pandas\\core\\generic.pyc\u001b[0m in \u001b[0;36mdrop\u001b[0;34m(self, labels, axis, level, inplace, errors)\u001b[0m\n\u001b[1;32m   1906\u001b[0m             \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m   1907\u001b[0m                 \u001b[0mnew_axis\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0maxis\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdrop\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mlabels\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0merrors\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0merrors\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1908\u001b[0;31m             \u001b[0mdropped\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mreindex\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m**\u001b[0m\u001b[1;33m{\u001b[0m\u001b[0maxis_name\u001b[0m\u001b[1;33m:\u001b[0m \u001b[0mnew_axis\u001b[0m\u001b[1;33m}\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   1909\u001b[0m             \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m   1910\u001b[0m                 \u001b[0mdropped\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0maxes\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0maxis_\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mset_names\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0maxis\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mnames\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0minplace\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mTrue\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[0;32mD:\\myProgramFiles\\Anaconda2\\lib\\site-packages\\pandas\\core\\frame.pyc\u001b[0m in \u001b[0;36mreindex\u001b[0;34m(self, index, columns, **kwargs)\u001b[0m\n\u001b[1;32m   2819\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0mreindex\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mindex\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mNone\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcolumns\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mNone\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m   2820\u001b[0m         return super(DataFrame, self).reindex(index=index, columns=columns,\n\u001b[0;32m-> 2821\u001b[0;31m                                               **kwargs)\n\u001b[0m\u001b[1;32m   2822\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m   2823\u001b[0m     \u001b[1;33m@\u001b[0m\u001b[0mAppender\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0m_shared_docs\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'reindex_axis'\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m%\u001b[0m \u001b[0m_shared_doc_kwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[0;32mD:\\myProgramFiles\\Anaconda2\\lib\\site-packages\\pandas\\core\\generic.pyc\u001b[0m in \u001b[0;36mreindex\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m   2257\u001b[0m         \u001b[1;31m# perform the reindex on the axes\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m   2258\u001b[0m         return self._reindex_axes(axes, level, limit, tolerance, method,\n\u001b[0;32m-> 2259\u001b[0;31m                                   fill_value, copy).__finalize__(self)\n\u001b[0m\u001b[1;32m   2260\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m   2261\u001b[0m     def _reindex_axes(self, axes, level, limit, tolerance, method, fill_value,\n",
      "\u001b[0;32mD:\\myProgramFiles\\Anaconda2\\lib\\site-packages\\pandas\\core\\frame.pyc\u001b[0m in \u001b[0;36m_reindex_axes\u001b[0;34m(self, axes, level, limit, tolerance, method, fill_value, copy)\u001b[0m\n\u001b[1;32m   2760\u001b[0m         \u001b[1;32mif\u001b[0m \u001b[0mcolumns\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[0mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m   2761\u001b[0m             frame = frame._reindex_columns(columns, copy, level, fill_value,\n\u001b[0;32m-> 2762\u001b[0;31m                                            limit, tolerance)\n\u001b[0m\u001b[1;32m   2763\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m   2764\u001b[0m         \u001b[0mindex\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0maxes\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'index'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[0;32mD:\\myProgramFiles\\Anaconda2\\lib\\site-packages\\pandas\\core\\frame.pyc\u001b[0m in \u001b[0;36m_reindex_columns\u001b[0;34m(self, new_columns, copy, level, fill_value, limit, tolerance)\u001b[0m\n\u001b[1;32m   2785\u001b[0m         return self._reindex_with_indexers({1: [new_columns, indexer]},\n\u001b[1;32m   2786\u001b[0m                                            \u001b[0mcopy\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mcopy\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mfill_value\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mfill_value\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2787\u001b[0;31m                                            allow_dups=False)\n\u001b[0m\u001b[1;32m   2788\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m   2789\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0m_reindex_multi\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0maxes\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcopy\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mfill_value\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[0;32mD:\\myProgramFiles\\Anaconda2\\lib\\site-packages\\pandas\\core\\generic.pyc\u001b[0m in \u001b[0;36m_reindex_with_indexers\u001b[0;34m(self, reindexers, fill_value, copy, allow_dups)\u001b[0m\n\u001b[1;32m   2369\u001b[0m                                                 \u001b[0mfill_value\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mfill_value\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m   2370\u001b[0m                                                 \u001b[0mallow_dups\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mallow_dups\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2371\u001b[0;31m                                                 copy=copy)\n\u001b[0m\u001b[1;32m   2372\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m   2373\u001b[0m         \u001b[1;32mif\u001b[0m \u001b[0mcopy\u001b[0m \u001b[1;32mand\u001b[0m \u001b[0mnew_data\u001b[0m \u001b[1;32mis\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_data\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[0;32mD:\\myProgramFiles\\Anaconda2\\lib\\site-packages\\pandas\\core\\internals.pyc\u001b[0m in \u001b[0;36mreindex_indexer\u001b[0;34m(self, new_axis, indexer, axis, fill_value, allow_dups, copy)\u001b[0m\n\u001b[1;32m   3844\u001b[0m         \u001b[1;32mif\u001b[0m \u001b[0maxis\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;36m0\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m   3845\u001b[0m             new_blocks = self._slice_take_blocks_ax0(indexer,\n\u001b[0;32m-> 3846\u001b[0;31m                                                      fill_tuple=(fill_value,))\n\u001b[0m\u001b[1;32m   3847\u001b[0m         \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m   3848\u001b[0m             new_blocks = [blk.take_nd(indexer, axis=axis, fill_tuple=(\n",
      "\u001b[0;32mD:\\myProgramFiles\\Anaconda2\\lib\\site-packages\\pandas\\core\\internals.pyc\u001b[0m in \u001b[0;36m_slice_take_blocks_ax0\u001b[0;34m(self, slice_or_indexer, fill_tuple)\u001b[0m\n\u001b[1;32m   3924\u001b[0m                     blocks.append(blk.take_nd(blklocs[mgr_locs.indexer],\n\u001b[1;32m   3925\u001b[0m                                               \u001b[0maxis\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mnew_mgr_locs\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mmgr_locs\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3926\u001b[0;31m                                               fill_tuple=None))\n\u001b[0m\u001b[1;32m   3927\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m   3928\u001b[0m         \u001b[1;32mreturn\u001b[0m \u001b[0mblocks\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[0;32mD:\\myProgramFiles\\Anaconda2\\lib\\site-packages\\pandas\\core\\internals.pyc\u001b[0m in \u001b[0;36mtake_nd\u001b[0;34m(self, indexer, axis, new_mgr_locs, fill_tuple)\u001b[0m\n\u001b[1;32m   1016\u001b[0m             \u001b[0mfill_value\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfill_value\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m   1017\u001b[0m             new_values = algos.take_nd(values, indexer, axis=axis,\n\u001b[0;32m-> 1018\u001b[0;31m                                        allow_fill=False)\n\u001b[0m\u001b[1;32m   1019\u001b[0m         \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m   1020\u001b[0m             \u001b[0mfill_value\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mfill_tuple\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[0;32mD:\\myProgramFiles\\Anaconda2\\lib\\site-packages\\pandas\\core\\algorithms.pyc\u001b[0m in \u001b[0;36mtake_nd\u001b[0;34m(arr, indexer, axis, out, fill_value, mask_info, allow_fill)\u001b[0m\n\u001b[1;32m   1098\u001b[0m             \u001b[0mout\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mempty\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mout_shape\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mdtype\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0morder\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m'F'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m   1099\u001b[0m         \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1100\u001b[0;31m             \u001b[0mout\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mempty\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mout_shape\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mdtype\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   1101\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m   1102\u001b[0m     func = _get_take_nd_function(arr.ndim, arr.dtype, out.dtype, axis=axis,\n",
      "\u001b[0;31mMemoryError\u001b[0m: "
     ]
    }
   ],
   "source": [
    "sampler = np.random.randint(0,len(train_negative), size = int(len(train_negative)*0.8))\n",
    "part_negative = train_negative.take(sampler)\n",
    "print len(part_negative)\n",
    "\n",
    "sampler = np.random.randint(0,len(test_negative), size = int(len(test_negative)*0.8))\n",
    "part_test_negative = test_negative.take(sampler)\n",
    "print len(part_test_negative)\n",
    "\n",
    "train = pd.concat([train_postive,train_postive,train_postive,train_postive,part_negative,train_postive,train_postive,train_postive,train_postive,],axis=0,ignore_index=True)\n",
    "test = pd.concat([test_postive,part_test_negative],axis=0,ignore_index=True)\n",
    "\n",
    "train_label = train['type']\n",
    "test_label = test['type']\n",
    "\n",
    "train = train.drop(['uid', 'spu_id', 'type','date'],axis =1) \n",
    "test = test.drop(['uid', 'spu_id', 'type','date'],axis=1) \n",
    "\n",
    "dtrain = xgb.DMatrix(train, train_label, missing=-1)\n",
    "dtest = xgb.DMatrix(test,test_label, missing=-1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0]\tval-auc:0.768773\ttrain-auc:0.779716\tval-FSCORE:0.459046\ttrain-FSCORE:0.463733\n",
      "Multiple eval metrics have been passed: 'train-FSCORE' will be used for early stopping.\n",
      "\n",
      "Will train until train-FSCORE hasn't improved in 10 rounds.\n",
      "[1]\tval-auc:0.77199\ttrain-auc:0.782192\tval-FSCORE:0.42286\ttrain-FSCORE:0.432311\n",
      "[2]\tval-auc:0.775125\ttrain-auc:0.785484\tval-FSCORE:0.390782\ttrain-FSCORE:0.405128\n",
      "[3]\tval-auc:0.775509\ttrain-auc:0.785935\tval-FSCORE:0.362402\ttrain-FSCORE:0.381693\n",
      "[4]\tval-auc:0.779908\ttrain-auc:0.790458\tval-FSCORE:0.337261\ttrain-FSCORE:0.361553\n",
      "[5]\tval-auc:0.78186\ttrain-auc:0.792702\tval-FSCORE:0.315119\ttrain-FSCORE:0.344311\n",
      "[6]\tval-auc:0.782208\ttrain-auc:0.793177\tval-FSCORE:0.295549\ttrain-FSCORE:0.329629\n",
      "[7]\tval-auc:0.782147\ttrain-auc:0.793281\tval-FSCORE:0.278311\ttrain-FSCORE:0.317174\n",
      "[8]\tval-auc:0.782307\ttrain-auc:0.793583\tval-FSCORE:0.263211\ttrain-FSCORE:0.306643\n",
      "[9]\tval-auc:0.783308\ttrain-auc:0.794615\tval-FSCORE:0.249929\ttrain-FSCORE:0.297763\n",
      "[10]\tval-auc:0.783742\ttrain-auc:0.795049\tval-FSCORE:0.238334\ttrain-FSCORE:0.290322\n",
      "[11]\tval-auc:0.7841\ttrain-auc:0.795483\tval-FSCORE:0.228198\ttrain-FSCORE:0.284094\n",
      "[12]\tval-auc:0.784747\ttrain-auc:0.795936\tval-FSCORE:0.219378\ttrain-FSCORE:0.278899\n",
      "[13]\tval-auc:0.785178\ttrain-auc:0.796516\tval-FSCORE:0.211694\ttrain-FSCORE:0.274568\n",
      "[14]\tval-auc:0.785581\ttrain-auc:0.797025\tval-FSCORE:0.205031\ttrain-FSCORE:0.27098\n",
      "[15]\tval-auc:0.785865\ttrain-auc:0.797374\tval-FSCORE:0.199262\ttrain-FSCORE:0.268004\n",
      "[16]\tval-auc:0.786207\ttrain-auc:0.797719\tval-FSCORE:0.19427\ttrain-FSCORE:0.26554\n",
      "[17]\tval-auc:0.786383\ttrain-auc:0.797963\tval-FSCORE:0.189953\ttrain-FSCORE:0.263514\n",
      "[18]\tval-auc:0.786844\ttrain-auc:0.798529\tval-FSCORE:0.186177\ttrain-FSCORE:0.261833\n",
      "[19]\tval-auc:0.787161\ttrain-auc:0.798907\tval-FSCORE:0.182932\ttrain-FSCORE:0.260447\n",
      "[20]\tval-auc:0.787382\ttrain-auc:0.799169\tval-FSCORE:0.180094\ttrain-FSCORE:0.259293\n",
      "[21]\tval-auc:0.787698\ttrain-auc:0.799547\tval-FSCORE:0.177651\ttrain-FSCORE:0.258345\n",
      "[22]\tval-auc:0.788153\ttrain-auc:0.800079\tval-FSCORE:0.17556\ttrain-FSCORE:0.257552\n",
      "[23]\tval-auc:0.788418\ttrain-auc:0.800393\tval-FSCORE:0.173723\ttrain-FSCORE:0.256906\n",
      "[24]\tval-auc:0.788623\ttrain-auc:0.800618\tval-FSCORE:0.172149\ttrain-FSCORE:0.256365\n",
      "[25]\tval-auc:0.788923\ttrain-auc:0.800954\tval-FSCORE:0.170781\ttrain-FSCORE:0.255911\n",
      "[26]\tval-auc:0.789225\ttrain-auc:0.801274\tval-FSCORE:0.169566\ttrain-FSCORE:0.255537\n",
      "[27]\tval-auc:0.789503\ttrain-auc:0.801573\tval-FSCORE:0.168498\ttrain-FSCORE:0.255219\n",
      "[28]\tval-auc:0.789714\ttrain-auc:0.801849\tval-FSCORE:0.167578\ttrain-FSCORE:0.254955\n",
      "[29]\tval-auc:0.789873\ttrain-auc:0.802248\tval-FSCORE:0.166776\ttrain-FSCORE:0.254729\n",
      "[30]\tval-auc:0.790107\ttrain-auc:0.8026\tval-FSCORE:0.166083\ttrain-FSCORE:0.254535\n",
      "[31]\tval-auc:0.790257\ttrain-auc:0.802872\tval-FSCORE:0.165462\ttrain-FSCORE:0.25437\n",
      "[32]\tval-auc:0.790444\ttrain-auc:0.803163\tval-FSCORE:0.164953\ttrain-FSCORE:0.254233\n",
      "[33]\tval-auc:0.790642\ttrain-auc:0.803381\tval-FSCORE:0.164499\ttrain-FSCORE:0.254116\n",
      "[34]\tval-auc:0.790798\ttrain-auc:0.803591\tval-FSCORE:0.164101\ttrain-FSCORE:0.254008\n",
      "[35]\tval-auc:0.790934\ttrain-auc:0.803762\tval-FSCORE:0.163751\ttrain-FSCORE:0.253927\n",
      "[36]\tval-auc:0.791082\ttrain-auc:0.803967\tval-FSCORE:0.16343\ttrain-FSCORE:0.253849\n",
      "[37]\tval-auc:0.791218\ttrain-auc:0.804151\tval-FSCORE:0.16315\ttrain-FSCORE:0.253771\n",
      "[38]\tval-auc:0.791365\ttrain-auc:0.804393\tval-FSCORE:0.16292\ttrain-FSCORE:0.253708\n",
      "[39]\tval-auc:0.791433\ttrain-auc:0.804599\tval-FSCORE:0.16272\ttrain-FSCORE:0.253648\n",
      "[40]\tval-auc:0.791526\ttrain-auc:0.804727\tval-FSCORE:0.162541\ttrain-FSCORE:0.253598\n",
      "[41]\tval-auc:0.79163\ttrain-auc:0.804991\tval-FSCORE:0.162384\ttrain-FSCORE:0.253545\n",
      "[42]\tval-auc:0.791722\ttrain-auc:0.805217\tval-FSCORE:0.162261\ttrain-FSCORE:0.25349\n",
      "[43]\tval-auc:0.791879\ttrain-auc:0.805476\tval-FSCORE:0.16214\ttrain-FSCORE:0.25345\n",
      "[44]\tval-auc:0.791957\ttrain-auc:0.805649\tval-FSCORE:0.162042\ttrain-FSCORE:0.253409\n",
      "[45]\tval-auc:0.792048\ttrain-auc:0.805845\tval-FSCORE:0.161953\ttrain-FSCORE:0.253377\n",
      "[46]\tval-auc:0.79215\ttrain-auc:0.806112\tval-FSCORE:0.161834\ttrain-FSCORE:0.253322\n",
      "[47]\tval-auc:0.792224\ttrain-auc:0.806314\tval-FSCORE:0.161757\ttrain-FSCORE:0.253292\n",
      "[48]\tval-auc:0.792294\ttrain-auc:0.806488\tval-FSCORE:0.161721\ttrain-FSCORE:0.253251\n",
      "[49]\tval-auc:0.792385\ttrain-auc:0.806692\tval-FSCORE:0.161621\ttrain-FSCORE:0.253208\n",
      "[50]\tval-auc:0.792512\ttrain-auc:0.806929\tval-FSCORE:0.161595\ttrain-FSCORE:0.253185\n",
      "[51]\tval-auc:0.792621\ttrain-auc:0.807094\tval-FSCORE:0.161545\ttrain-FSCORE:0.253148\n",
      "[52]\tval-auc:0.792655\ttrain-auc:0.807297\tval-FSCORE:0.161531\ttrain-FSCORE:0.253119\n",
      "[53]\tval-auc:0.792759\ttrain-auc:0.807481\tval-FSCORE:0.161512\ttrain-FSCORE:0.253098\n",
      "[54]\tval-auc:0.792782\ttrain-auc:0.807687\tval-FSCORE:0.161485\ttrain-FSCORE:0.253067\n",
      "[55]\tval-auc:0.792856\ttrain-auc:0.807844\tval-FSCORE:0.161445\ttrain-FSCORE:0.25303\n",
      "[56]\tval-auc:0.792882\ttrain-auc:0.80805\tval-FSCORE:0.16139\ttrain-FSCORE:0.252991\n",
      "[57]\tval-auc:0.79293\ttrain-auc:0.808179\tval-FSCORE:0.161363\ttrain-FSCORE:0.252959\n",
      "[58]\tval-auc:0.792926\ttrain-auc:0.808477\tval-FSCORE:0.161333\ttrain-FSCORE:0.252934\n",
      "[59]\tval-auc:0.79297\ttrain-auc:0.808611\tval-FSCORE:0.161329\ttrain-FSCORE:0.252909\n",
      "[60]\tval-auc:0.793018\ttrain-auc:0.808808\tval-FSCORE:0.161361\ttrain-FSCORE:0.252889\n",
      "[61]\tval-auc:0.79298\ttrain-auc:0.809082\tval-FSCORE:0.161346\ttrain-FSCORE:0.252867\n",
      "[62]\tval-auc:0.793006\ttrain-auc:0.809374\tval-FSCORE:0.161325\ttrain-FSCORE:0.252841\n",
      "[63]\tval-auc:0.793017\ttrain-auc:0.809543\tval-FSCORE:0.16132\ttrain-FSCORE:0.252814\n",
      "[64]\tval-auc:0.793071\ttrain-auc:0.809704\tval-FSCORE:0.161305\ttrain-FSCORE:0.252789\n",
      "[65]\tval-auc:0.793092\ttrain-auc:0.809882\tval-FSCORE:0.161287\ttrain-FSCORE:0.252752\n",
      "[66]\tval-auc:0.793115\ttrain-auc:0.809987\tval-FSCORE:0.161287\ttrain-FSCORE:0.252723\n",
      "[67]\tval-auc:0.793141\ttrain-auc:0.810111\tval-FSCORE:0.161306\ttrain-FSCORE:0.252705\n",
      "[68]\tval-auc:0.793157\ttrain-auc:0.810214\tval-FSCORE:0.16131\ttrain-FSCORE:0.252677\n",
      "[69]\tval-auc:0.793184\ttrain-auc:0.810321\tval-FSCORE:0.161318\ttrain-FSCORE:0.252656\n",
      "[70]\tval-auc:0.793219\ttrain-auc:0.810534\tval-FSCORE:0.161326\ttrain-FSCORE:0.252631\n",
      "[71]\tval-auc:0.793217\ttrain-auc:0.810595\tval-FSCORE:0.161329\ttrain-FSCORE:0.252615\n",
      "[72]\tval-auc:0.79324\ttrain-auc:0.810683\tval-FSCORE:0.161337\ttrain-FSCORE:0.252593\n",
      "[73]\tval-auc:0.793247\ttrain-auc:0.810816\tval-FSCORE:0.161315\ttrain-FSCORE:0.252571\n",
      "[74]\tval-auc:0.793267\ttrain-auc:0.810905\tval-FSCORE:0.16132\ttrain-FSCORE:0.252539\n",
      "[75]\tval-auc:0.793287\ttrain-auc:0.811004\tval-FSCORE:0.161317\ttrain-FSCORE:0.252515\n",
      "[76]\tval-auc:0.793314\ttrain-auc:0.811153\tval-FSCORE:0.161311\ttrain-FSCORE:0.252491\n",
      "[77]\tval-auc:0.79332\ttrain-auc:0.811206\tval-FSCORE:0.161331\ttrain-FSCORE:0.252477\n",
      "[78]\tval-auc:0.793312\ttrain-auc:0.811348\tval-FSCORE:0.161347\ttrain-FSCORE:0.252455\n",
      "[79]\tval-auc:0.793322\ttrain-auc:0.811433\tval-FSCORE:0.161368\ttrain-FSCORE:0.25243\n",
      "[80]\tval-auc:0.793333\ttrain-auc:0.81158\tval-FSCORE:0.16137\ttrain-FSCORE:0.252408\n",
      "[81]\tval-auc:0.793329\ttrain-auc:0.811625\tval-FSCORE:0.161394\ttrain-FSCORE:0.252383\n",
      "[82]\tval-auc:0.793301\ttrain-auc:0.81185\tval-FSCORE:0.161395\ttrain-FSCORE:0.252359\n",
      "[83]\tval-auc:0.793296\ttrain-auc:0.811979\tval-FSCORE:0.161439\ttrain-FSCORE:0.25234\n",
      "[84]\tval-auc:0.793318\ttrain-auc:0.812146\tval-FSCORE:0.161442\ttrain-FSCORE:0.252305\n",
      "[85]\tval-auc:0.793307\ttrain-auc:0.812195\tval-FSCORE:0.16144\ttrain-FSCORE:0.252296\n",
      "[86]\tval-auc:0.793328\ttrain-auc:0.812331\tval-FSCORE:0.161433\ttrain-FSCORE:0.252274\n",
      "[87]\tval-auc:0.793331\ttrain-auc:0.812378\tval-FSCORE:0.161433\ttrain-FSCORE:0.25225\n",
      "[88]\tval-auc:0.793341\ttrain-auc:0.812547\tval-FSCORE:0.161425\ttrain-FSCORE:0.252232\n",
      "[89]\tval-auc:0.793325\ttrain-auc:0.812702\tval-FSCORE:0.161423\ttrain-FSCORE:0.252213\n",
      "[90]\tval-auc:0.793335\ttrain-auc:0.812766\tval-FSCORE:0.161423\ttrain-FSCORE:0.252198\n",
      "[91]\tval-auc:0.793319\ttrain-auc:0.812886\tval-FSCORE:0.161426\ttrain-FSCORE:0.252177\n",
      "[92]\tval-auc:0.79331\ttrain-auc:0.81295\tval-FSCORE:0.161422\ttrain-FSCORE:0.25217\n",
      "[93]\tval-auc:0.793314\ttrain-auc:0.813039\tval-FSCORE:0.16145\ttrain-FSCORE:0.252158\n",
      "[94]\tval-auc:0.793305\ttrain-auc:0.813085\tval-FSCORE:0.161451\ttrain-FSCORE:0.252145\n",
      "[95]\tval-auc:0.793288\ttrain-auc:0.813225\tval-FSCORE:0.161467\ttrain-FSCORE:0.252124\n",
      "[96]\tval-auc:0.793277\ttrain-auc:0.813246\tval-FSCORE:0.161468\ttrain-FSCORE:0.252108\n",
      "[97]\tval-auc:0.793278\ttrain-auc:0.813365\tval-FSCORE:0.161487\ttrain-FSCORE:0.252091\n",
      "[98]\tval-auc:0.793297\ttrain-auc:0.813618\tval-FSCORE:0.161502\ttrain-FSCORE:0.252059\n",
      "[99]\tval-auc:0.793304\ttrain-auc:0.813679\tval-FSCORE:0.161499\ttrain-FSCORE:0.252036\n",
      "445.338999987\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(0.252036, 99, 100)"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "params = {        \n",
    "            'max_depth':3,\n",
    "            'min_child_weight':1,\n",
    "            'eta':0.1,\n",
    "            'subsample':1,\n",
    "            'colsample_bytree':1,\n",
    "            'scale_pos_weight':1,\n",
    "            'max_delta_step': 0,\n",
    "            'eval_metric':'auc',\n",
    "            'lambda' :0,\n",
    "            'alpha': 0,\n",
    "            'gamma': 0,\n",
    "            'seed': 1,\n",
    "            'objective':'binary:logistic',\n",
    "}\n",
    "evallist = [ (dtest, 'val'), (dtrain, 'train')]\n",
    "\n",
    "t0 = time.time()\n",
    "model = xgb.train(params,dtrain,num_boost_round=100,evals = evallist, early_stopping_rounds=10 ,feval=eval_avg_sqt)\n",
    "print time.time() - t0\n",
    "\n",
    "model.best_score,model.best_iteration,model.best_ntree_limit"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "x_pred = xgb.DMatrix(test)\n",
    "y_pred = model.predict(x_pred)\n",
    "print y_pred\n",
    "metrics.brier_score_loss(y_pred, test_label)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
